package com.siae.controller;

import com.siae.pojo.Audit;
import com.siae.pojo.vo.Result;
import com.siae.service.AuditService;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Date;
import java.util.List;

@RestController
@RequestMapping("/audit")
@Tag(name = "AuditController",description = "审核操作")
public class AuditController {
    @Autowired
    private AuditService auditService;

    @GetMapping
    public Result<List<Audit>> getAllAudits(
            @RequestParam(value = "status",defaultValue = "") Integer status) {
        return auditService.getAllAudits(status);
    }

    @GetMapping("/{id}")
    public Result<Audit> getAuditById(@PathVariable("id") Integer id) {
        return auditService.getAuditById(id);
    }
    @PostMapping
    public Result addAudit(@RequestBody Audit audit) {
        return auditService.addAudit(audit);
    }
    @PutMapping
    public Result updateAudit(@RequestBody Audit audit) {
        return auditService.updateAudit(audit);
    }
    @DeleteMapping()
    public Result deleteAudit(@RequestBody List idList) {
        return auditService.deleteListAudit(idList);
    }
}
